<?php
/**
 * (exporter) shopify产品销售 (导出)
 */

namespace App\Exporter\Products;


use App\Models\Product\ProductClassify;
use App\Util\User;
use Encore\Admin\Grid\Exporters\ExcelExporter;
use Maatwebsite\Excel\Concerns\WithMapping;

class ShopifySkuCCSExporter extends ExcelExporter implements WithMapping{

    protected $fileName = 'shopify产品销售.csv';

    protected $headings = ['国家','季节性','品类','销售员','品类状态'];

    public function map($model) : array
    {
        return [
            $model->country->country ?? '',
            ProductClassify::$_season[$model->classify->season ?? 3],
            $model->classify->title ?? '',
            User::getUsernameById($model->seller_id),
            isset($model->classify->deleted_at) && $model->classify->deleted_at ? '停用' : '启用'
        ];
    }

}
